home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / dtk_demo.zip / ALL_DRVS.C < prev    next >
C/C++ Source or Header  |  1991-09-12  |  2KB  |  80 lines

  1. /*  ALL_DRVS.C
  2.  *  last mod.: 24-JUN-91
  3.  */
  4.  
  5. /*  this does not require a disk to be in the floppy drive(s)  */
  6.  
  7. #include <STDIO.H>
  8. #include <L_DISK.H>
  9.  
  10. void main(void);
  11. void report_drive_parameters(int drive_num);
  12.  
  13. /*-----------*/
  14. void main(void)
  15. {
  16. int i;
  17. int num_floppy = num_floppy_drives();
  18. int num_hard = num_hard_drives();
  19.  
  20. printf("\nNumber of floppy drives = %d",num_floppy);
  21. for ( i=0; i<num_floppy; i++ )
  22.     {
  23.     printf("\nFloppy drive #%d: ",i);
  24.     report_drive_parameters(i);
  25.     }
  26.  
  27. printf("\nNumber of hard drives = %d",num_hard);
  28. for ( i=0; i<num_hard; i++ )
  29.     {
  30.     printf("\nHard drive #%d: ",i);
  31.     report_drive_parameters(i+128);
  32.     }
  33. }
  34.  
  35. /*---------------------------------------*/
  36. void report_drive_parameters(int drive_num)
  37. {
  38. Uint num_sectors, num_cylinders, num_heads;
  39. int type = drive_type(drive_num,&num_sectors,&num_cylinders,&num_heads);
  40.  
  41. switch ( type )
  42.     {
  43.     case -1:
  44.         printf("Invalid drive number.\n");
  45.         break;
  46.     case -2:
  47.         printf("Function not supported by BIOS.\n");
  48.         break;
  49.     case -3:
  50.         printf("BIOS reports an error.\n");
  51.         break;
  52.     default:
  53.         {
  54.         switch ( type )
  55.             {
  56.             case _D_FIXEDDISK:
  57.                 printf("Fixed");
  58.                 break;
  59.             case _D_360KB:
  60.                 printf("360KB 5.25\" floppy");
  61.                 break;
  62.             case _D_12MB:
  63.                 printf("1.2MB 5.25\" floppy");
  64.                 break;
  65.             case _D_720KB:
  66.                 printf("720KB 3.5\" floppy");
  67.                 break;
  68.             case _D_144MB:
  69.                 printf("1.44MB 3.5\" floppy");
  70.                 break;
  71.             default:
  72.                 printf("Unidentified ");
  73.             }
  74.         printf(" disk drive with\n"
  75.             "%d sectors per track, %d tracks and %d heads.\n",
  76.             num_sectors,num_cylinders,num_heads);
  77.         }
  78.     }
  79. }
  80.